package Calendar类编程题;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class InferDayOfWeek {
    public static String getCorrectDayOfWeek(Calendar calendar){
        String[] dayOfWeek = new String[]{
                "星期日","星期一","星期二","星期三","星期四","星期五","星期六"
        };
        return dayOfWeek[calendar.get(Calendar.DAY_OF_WEEK)-1];
    }
    public static void main(String[] args) {
        Calendar calendar = new GregorianCalendar(1949,9,1);
        System.out.println(InferDayOfWeek.getCorrectDayOfWeek(calendar));
        calendar.set(2022,5,9);
        System.out.println(InferDayOfWeek.getCorrectDayOfWeek(calendar));
    }
}
